import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'spotData.dart';
import 'package:flutter_app/config/colorconfig.dart';

class spotPageBuild extends StatefulWidget {
  final int index;
  spotPageBuild({this.index});
  @override
  _spotPageBuildState createState() => _spotPageBuildState();
}

class _spotPageBuildState extends State<spotPageBuild> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        backgroundColor: Colors.white,
        leading: BackButton(
          color: Colors.black,
        ),
        title: Text(
          spotData[widget.index]["title"],
          style: TextStyle(
            color: Colors.black,
          ),
        ),
      ),
      body: Column(
        children: <Widget>[
          Container(
            height: MediaQuery.of(context).size.width * 0.73,
            //color: Colors.white,
            child: Swiper(
              itemCount: spotData[widget.index]["pictureCount"],
              itemBuilder: (BuildContext context, int index) {
                return Image.asset(spotData[widget.index]["picture"][index]);
              },
              pagination: SwiperPagination(
                  alignment: Alignment.bottomCenter,
                  margin: EdgeInsets.all(0),
                  builder: DotSwiperPaginationBuilder(
                    color: Color.fromRGBO(220, 240, 215, 1),
                    activeColor: Color.fromRGBO(220, 10, 10, 1),
                  )),
            ),
          ),
          Container(
            child: Column(
              children: <Widget>[
                Container(
                    padding: EdgeInsets.fromLTRB(0, 10, 0, 10),
                    child: Row(
                      children: <Widget>[
                        Container(
                          width: 20,
                        ),
                        Container(
                          child: Text(
                            spotData[widget.index]["title"],
                            style: TextStyle(fontSize: 22),
                          ),
                        )
                      ],
                    ),
                    alignment: Alignment.topLeft),
                Container(
                    child: Row(
                      children: <Widget>[
                        Container(
                          width: 20,
                        ),
                        Container(
                          child: Text(
                            spotData[widget.index]["description"],
                            style: TextStyle(
                                fontSize: 17,
                                color: Color.fromRGBO(150, 230, 210, 1)),
                            textAlign: TextAlign.left,
                          ),
                        )
                      ],
                    ),
                    alignment: Alignment.topLeft)
              ],
            ),
            //alignment: Alignment(-0.5, 0),
          )
        ],
      ),
    );
  }
}
